<?php
/**
*
* @author Blackpawn blackpawn666@hotmail.com - http://blackpawnsarchives.net
* @co_author GameCharmer admin@gamecharmer.com - http://gaming.gamecharmer.com
* @package Age of Dragons Mod :: ( Game Console Required )
* @version $Id: create.php 1.1.1 12-26-2009 Blackpawn
* @copyright (c) 2009 Blackpawns Archives
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
if (!defined('AOD'))
{
	exit;
}
	// Default full status zero equal open
	$game_full = 0;

	if($available_slots > 0)
	{
		// Fetch the amount of available slots
		$available_slots = ($game[$game_id]['member_slots'] - $game[$game_id]['members']);
		
		// Detect if game is full
		if($available_slots < 1)
		{
			// 1 equals the game is full
			$game_full = 1;
		}	
	}
	
	// Detect if game is online
	$online_status = $game[$game_id]['online'];
	
	// Display the ticks left if the round is coming to an end
	if($days_left < 1)
	{
		$ticks_left_display = '
		<table border="1" cellspacing="0" cellpadding="0" align="center" width="99%" class="game_ticker">
			<tr>
				<td align="center" class="game_head"><span class="ntextred"><b>'.sprintF($user->lang['TICKS_LEFT_IN_ROUND'],$ticks_left).'</b></span></td>
			</tr>
		</table>
		<br>';
	}

	// Display an error messages to the user
	if($error_msgs){
		$error_msgs = '<span class="errormsg"><b>'.$error_msgs.'</b></span>';
	}
	
	if(empty($kingdom_ruler))
	{
		$kingdom_ruler = $user->data['username'];
	}
	
	$template->assign_vars(array(
		'TICKS_LEFT'				=> $ticks_left_display,
		'ERROR_MSGS'				=> $error_msgs,		
		'CSS'						=> $custom_css,
		'GAME_ID'					=> $game_id,
		'BULLETIN'					=> $game_bulletin,
		'S_BULLETIN_SHOW'			=> $game_bulletin_show,
		'S_FULL_GAME'				=> $game_full,	
		'S_ONLINE_STATUS'			=> $online_status,
		'S_ADMIN'					=> $admin,
		'S_KINGDOM_RULER'			=> $kingdom_advantage,
		'KINGDOM_RULER'				=> clean_text($kingdom_ruler,1),
		'KINGDOM_NAME'				=> clean_text($kingdom_name,1),
		'TURNS_ADVANTAGE' 			=> $aod_config['turns_advantage'],
		'STAMINA_ADVANTAGE' 		=> $aod_config['stamina_advantage'],
		'OFFDEF_ADVANTAGE' 			=> ($aod_config['offdef_advantage'] * 100),
		'UNITCOST_ADVANTAGE' 		=> ($aod_config['unitcost_advantage'] * 100),
		)
	);

	// Output page
	page_header($game_name);

	$template->set_filenames(array(
		'body' => $templates_path.'create_body.html')
	);

	page_footer();	
?>